﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Forum.Entity.Post;
using Forum.DAL.Post;

using Forum.BLL.Member;
using Forum.Entity.Member;
using Frame.Lib.Web;
using Frame.Lib.Core.Base;

namespace Forum.BLL.Post
{
    public class PostBO : CommonOperate<PostInfo>
    {
        private PostDAL _forumPost;
        protected override BaseDAL DAL
        {
            get
            {
                return _forumPost;

            }
        }
        public PostBO()
        {
            _forumPost = new PostDAL();
        }


        public List<PostInfo> GetList(int topicID, PagerSetting pager)
        {
            List<PostInfo> list = base.GetList(pager, topicID);

            MemberExBO member = new MemberExBO();
            List<MemberExInfo> memberList = member.GetList(list.Select(T => T.MemberID));
            foreach (PostInfo info in list)
            {
                info.MemberInfo = memberList.Where(T => T.ID == info.MemberID).First();
            }

            return list;

        }
    }
}
